<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::name("f.")->namespace('Frontend')->group(function (){

    Route::name('auth.')->prefix('auth')->namespace('Auth')->group(function (){

        Route::post('/register', 'RegisterController@register')->name('register');

        Route::post('/login', 'AuthController@login')->name('login');

        Route::get('/logout', 'AuthController@logout')->name('logout');

        Route::post('/refresh', 'AuthController@refresh')->name('refresh');

        Route::post('/resend', 'VerificationController@resend')->name('resend');

        Route::post('/forgot', 'ForgotPasswordController@forgot')->name('forgot');

    });


    Route::middleware('auth:api')->group(function (){
        Route::name('auth.')->prefix('user')->namespace('User')->group(function (){
            Route::get('/profile', 'ProfileController@index')->name('profile');
            Route::get('/relation/index','RelationController@index')->name('relation_index');//好友列表分页
            Route::post('/relation/create','RelationController@create')->name('relation_create');//好友新增
            Route::post('/share/create','ShareController@createMany')->name('share_create');
            Route::post('/share/update/{id}','ShareController@update')->name('share_update');
        });

        Route::name('project.')->prefix('project')->namespace('Project')->group(function () {
            Route::get('/list', 'ProjectController@index')->name('list');
            Route::post('/create', 'ProjectController@create')->name('create');
            Route::post('/rename', 'ProjectController@rename')->name('rename');
            Route::post('/copy', 'ProjectController@copy')->name('copy');
            Route::post('/trash', 'ProjectController@trash')->name('trash');
            Route::post('/restore', 'ProjectController@restore')->name('restore');
            Route::get('/trash/list', 'ProjectController@trashList')->name('trash_list');
        });
    });
});

Route::name('s.')->namespace('System')->group(function (){
    Route::name('common.')->prefix('common')->namespace('Common')->group(function() {
        Route::get('captcha', 'CaptchaController@show')->name('captcha');
    });
});

